﻿using System;
using System.Linq;
using System.Collections.Generic;

using WebMatrix.WebData;

namespace MiniSched.Web.Security.Abstractions {

    public class WebSecurityAbstraction {

        protected WebSecurityAbstraction() { }

        public static WebSecurityAbstraction Default { get { return _Default; } }
        private static readonly WebSecurityAbstraction _Default = new WebSecurityAbstraction();

        public virtual void InitializeDatabaseConnection(string connectionStringName, string userTableName, string userIdColumn, string userNameColumn, bool autoCreateTables) {
            WebSecurity.InitializeDatabaseConnection(connectionStringName, userTableName, userIdColumn, userNameColumn, autoCreateTables);
        }

        public virtual string CreateUserAndAccount(string userName, string password, object propertyValues = null, bool requireConfirmationToken = false) {
            return WebSecurity.CreateUserAndAccount(userName, password, propertyValues, requireConfirmationToken);
        }

        public virtual bool Login(string userName, string password, bool persistCookie = false) {
            return WebSecurity.Login(userName, password, persistCookie);
        }

        public virtual void Logout() {
            WebSecurity.Logout();
        }
    }
}
